package org.skipper.samples.mybatis.plus.crud.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.skipper.samples.mybatis.plus.crud.config.MyBaseMapper;
import org.skipper.samples.mybatis.plus.crud.entity.GiftInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;
import java.util.Optional;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author skipper
 * @since 2022-01-11
 */
public interface GiftInfoMapper extends MyBaseMapper<GiftInfo> {

    @Select("select * from gift_info")
    List<GiftInfo> getAllGift();

    @Select("select * from gift_info ${ew.customSqlSegment}")
    List<GiftInfo> getByWrapper(@Param(Constants.WRAPPER) Wrapper wrapper);

    @Select("select * from gift_info where id = #{id}")
    Optional<GiftInfo> getById(Long id);

    @Select("select * from gift_info")
    Page<GiftInfo> myPage(Page<GiftInfo> page);

}
